<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线商城后台管理</title>
<link rel="stylesheet" type="text/css" href="views/admin/style/css/basic.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/manager.css" />
<link rel="stylesheet" type="text/css" href="views/admin/style/css/pagination.css" />
<script type="text/javascript" src="views/common/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/jquery.artDialog.js?skin=idialog"></script>
<script type="text/javascript" src="views/common/js/artDialog4.1.6/plugins/iframeTools.js"></script>
<script type="text/javascript" src="views/common/js/jquery-validation/jquery.validate.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
    $("#add_level").click(function() {
        art.dialog.open('?c=level&m=add',{
            id:"iframe_add_level",
            title:'新增等级',
            width:'500px',
            height:'200px'
        }).lock();
    });
    $(".del").click(function() {
        var id = $(this).parents("tr").find("td:eq(0)").text();
        art.dialog.confirm('你确定要删除这条记录吗？', function () {
            $.get("?c=manager&m=checkLevel&level=" + id, function(msg){
                if(msg == 'false'){
                    art.dialog({
                        padding: '0px',
                        icon: 'warning',
                        title: '错误提示',
                        content: '此等级下有管理员，您无法删除！',
                        time: 1.5
                    }).lock();
                }else if(msg == 'true'){
                    $.get("?c=level&m=del&id=" + id,
                        function(msg){
                            if(msg == 'success'){
                                art.dialog.tips('删除成功！', 1.5);
                                setTimeout(function(){
                                    art.dialog.top.document.location.reload();
                                },1500);
                            } else {
                                art.dialog.tips('删除失败，请稍后重试！', 1.5);
                            }
                        }
                    );     
                }
            });
        });
    })
    $(".update").click(function() {
        var id = $(this).parents("tr").find("td:eq(0)").text();
        art.dialog.open('?c=level&m=update&id=' + id,{
            id:"iframe_update",
            title:'修改管理员等级',
            width:'500px',
            height:'200px'
        }).lock();
    });
})
</script>
<h2><a id="add_level" href="javascript:void(0)">新增等级</a>系统 -- 管理员等级列表</h2>

<div id="list">
	<table>
        <thead>
		<tr>
            <th>等级ID</th>
            <th>等级名称</th>
            <th>等级描述</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <{foreach from=$allLevel key=key item=value}>
		<tr>
            <td><{$value->id}></td>
            <td><{$value->level_name}></td>
            <td><{$value->level_info}></td>
            <td><a href="javascript:void(0)" class="update"><img src="views/admin/style/images/edit.gif" alt="编辑" title="编辑" /></a><a href="javascript:void(0)" class="del"><img src="views/admin/style/images/drop.gif" alt="删除" title="删除" />
            </a></td>
        </tr>
        <{foreachelse}>
            <tr><td colspan="4">暂无数据！</td></tr>
        <{/foreach}>
        </tbody>
         <tfoot>
            <tr class="action">
<!--                 <td><a href="#" class="button danger">删除</a></td> -->
                <td colspan="5">
                    <div class="pagination pagination-right">
                        <{$pagination}>
                    </div>
                </td>
            </tr>
        </tfoot>
	</table>
</div>
</body>
</html>